package io.renren.modules.app.controller;

import com.zheok.testing.entity.ProductEntity;
import com.zheok.testing.param.SearchParam;
import io.renren.modules.app.service.ProductService;
import io.renren.modules.sys.service.ThymeleafSc;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import utils.R;

import java.util.List;

/**
 * 搜索接口
 *
 * @author ææ¢
 * @email 2863751700@qq.com
 * @date 2022-07-31 19:06:14
 */
@Slf4j
@RestController
@RequestMapping("search/product")
public class SearchController {
    @Autowired
    private ProductService productService;

    /**
     * 列表
     */
    @RequestMapping("/index")
   // // //@RequiresPermissions("testing:activity:list")
    public R list(@RequestBody SearchParam params){
      List<ProductEntity> data= productService.search(params);
        return R.ok().put("data", data);
    }


    @Autowired
    private ThymeleafSc thymeleafPage;
    /**
     * 列表
     */
    @GetMapping("/start")
    // // //@RequiresPermissions("testing:activity:list")
    public R start(){
       try {
           thymeleafPage.test();
           return R.ok();
       }catch (Exception e){
           return R.error(e.getMessage());
       }
    }

}
